<?php
include_once('common/header.php');
if($AppUI->id <= 0 || (isset($_SESSION['covers']) && ($_SESSION['covers'] <= 0))) {
	Vfriend_Function::redirect(HOST_BACKEND);
}
$intStatus		= $objRequest->getParam('pstatus', 0);
$strOption		= $objRequest->getParam('poption', '');
$strKey			= $objRequest->getParam('pkey', '');
$strStart		= $objRequest->getParam('pstartdate', '');
$strEnd			= $objRequest->getParam('penddate', '');
$intPage		= $objRequest->getParam('page', 1);
$intCancel		= $objRequest->getParam('pcancel', 0);
$intLimit		= ADMIN_LIMIT;
$intOff			= (($intPage-1) * $intLimit);
$intTotal		= 0;
$objCover		= new Cover(); 
$arrResult		= $objCover->getAll($intStatus, $strOption, $strKey, Vfriend_Function::convertStrToDate($strStart), Vfriend_Function::convertStrToDate($strEnd), $intOff, $intLimit, $intTotal);
$strUrl			= HOST_BACKEND . 'cover/index?pstatus=' . $intStatus . '&';
if($strOption != '' || $strKey != '' || $strStart != '' || $strEnd != '') {
	$strUrl	   .= 'poption=' . $strOption . '&pkey=' . $strKey . '&pstart=' . $strStart . '&pend=' . $strEnd . '&' ;
	$_SESSION['cocancel'] = 1;	
	$_SESSION['copost']	 = $objRequest->getParams();
}
else {
	if(isset($_SESSION['copost'])) unset($_SESSION['copost']);
	if(isset($_SESSION['cocancel'])) unset($_SESSION['cocancel']);
}
if($intCancel) {
	if(isset($_SESSION['copost'])) unset($_SESSION['copost']);
	if(isset($_SESSION['cocancel'])) unset($_SESSION['cocancel']);
}
# list
$this->view->arrResult		= $arrResult;
$this->view->intTotal		= $intTotal;
$this->view->intOffset		= $intOff;
$this->view->intLimit		= $intLimit;
$this->view->strUrl			= $strUrl;
$this->view->arrOption		= $arrOption;
$this->view->arrStatus		= $arrStatus;
$this->view->intStatus		= $intStatus;
?>